﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OracleClient;
namespace OracleDAL.ElecBoss
{
   public class DiarySearch
    {
       public DataSet getRecordByDate(string strStart, string strEnd)
       {
           DataSet ds = new DataSet();
           StringBuilder sb = new StringBuilder();
           sb.Append(" select DUTYID,USERISN,TZZS,RCXJ,YWCL,GZGD,QT,STARTTIME,ENDTIME from DUTY_INFO ");
           sb.Append(" where 1=1 ");
           if (!(strStart.Length == 0 && strEnd.Length == 0))
           {
               sb.Append(" and starttime between " + strStart + " and " + strEnd + "");
           }
           ds = DBUtility.OracleHelper.Query(sb.ToString());
           return ds;
       }
       /// <summary>
       /// 获取记录
       /// </summary>
       /// <param name="strStart">开始时间</param>
       /// <param name="strEnd">结束时间</param>
       /// <param name="userISN">用户ID</param>
       /// <returns></returns>
       public DataSet getRecord(string strStart, string strEnd,string userISN)
       {
           DataSet ds = new DataSet();
           StringBuilder sb = new StringBuilder();
           sb.Append(" select DUTYID,USERISN,TZZS,RCXJ,YWCL,GZGD,QT,STARTTIME,ENDTIME from DUTY_INFO ");
           sb.Append(" where 1=1 ");
           if (!(strStart.Length == 0 && strEnd.Length == 0))
           {
               sb.Append(" and STARTTIME between " + strStart + " and " + strEnd + "");
           }
           if (userISN.Length > 0) {
               sb.Append(" and USERISN ='" + userISN + "' ");
           }
           ds = DBUtility.OracleHelper.Query(sb.ToString());
           return ds;
       }
       public DataSet getRecordByCall(string strStart, string strEnd)
       {
           DataSet ds = new DataSet();
           string strSql = "select dutyid,userisn,tzzs,rcxj,ywcl,gzgd,qt,starttime,endtime from duty_info";
           strSql += " where starttime between " + strStart + " and " + strEnd + "";
           ds = DBUtility.OracleHelper.Query(strSql);
           return ds;
       }
    }
}
